<template>
  <!-- 商品列表分层 -->
  <div class="GoodsFloor">
    <div class="container">
      <!-- 商品列表 分类2  -->
      <div class="home-banner-box">
        <a href="#">
          <img v-lazy="goosList.topImg" alt="" />
        </a>
      </div>
      <div class="home-brick-box home-brick-row-2-box xm-plain-box">
        <div class="box-hd clearfix">
          <h2 class="title">{{ goosList.title }}</h2>
          <div class="more">
            <ul class="tab-list">
              <li class="tab-active">热门</li>
              <li>{{ goosList.subTitle }}</li>
            </ul>
          </div>
        </div>
        <div class="box-bd">
          <div class="row">
            <div class="hox-bd-left">
              <ul class="brick-promo-list clearfix">
                <li
                  class="brick-item brick-item-m"
                  v-for="(leftChilds, index) in goosList.leftChilds"
                  :key="index"
                >
                  <a href="#">
                    <img v-lazy="leftChilds" alt="" />
                  </a>
                </li>
              </ul>
            </div>
            <div class="hox-bd-right">
              <ul class="brick-list clearfix">
                <div>
                  <!-- 7个大的商品的渲染 -->
                  <li
                    class="brick-item brick-item-m brick-item-m-2"
                    v-for="bigGoogs in bigGoodsList"
                    :key="bigGoogs.id"
                  >
                    <a href="#">
                      <div class="figure figure-img">
                        <img
                          width="160"
                          height="160"
                          v-lazy="bigGoogs.img"
                          alt=""
                        />
                      </div>
                      <h3 class="title">{{ bigGoogs.title }}</h3>
                      <p class="desc">{{ bigGoogs.desc }}</p>
                      <p class="price">
                        <span class="num">{{ bigGoogs.price }}</span
                        >元
                        <del>
                          <span class="num">{{ bigGoogs.del }}</span
                          >元
                        </del>
                      </p>
                    </a>
                  </li>
                </div>
                <div>
                  <!-- 那个小的商品的渲染 -->
                  <li class="brick-item brick-item-s">
                    <a href="#">
                      <div class="figure figure-img">
                        <img
                          width="80"
                          height="80"
                          v-lazy="smallGoodsList[0].img"
                          alt=""
                        />
                      </div>
                      <h3 class="title">{{ smallGoodsList[0].title }}</h3>
                      <p class="price">
                        <span class="num">{{ smallGoodsList[0].price }}</span
                        >元
                        <span>起</span>
                      </p>
                    </a>
                  </li>
                </div>
                <li class="brick-item brick-item-s">
                  <a href="#">
                    <div class="figure figure-more">
                      <i class="iconfont icon-xiangyou1"></i>
                    </div>
                    <div class="more">
                      浏览更多
                      <small>热门</small>
                    </div>
                  </a>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "GoodsTFloor",
  // 简单的父组件接受数据
  // props: ['goosList'],
  // 我们还可以申明数据的类型
  props: {
    goosList: {
      type: Object,
      // 默认是一个对象
      default: () => ({}),
    },
  },
  data() {
    return {
      // list: this.goosList,
    }
  },
  //我们需要计算一下一下数据
  computed: {
    bigGoodsList() {
      return this.goosList.hotChilds.slice(0, 7)
    },
    smallGoodsList() {
      return this.goosList.hotChilds.slice(7, 8)
    },
  },
}
</script>

<style lang="less" scoped>
.home-banner-box {
  height: 120px;
  margin: 22px 0;
  overflow: hidden;
}

// home-brick-box 单个盒子的样式
// 右边的样式

.hox-bd-left {
  float: left;
  width: 234px;
  margin-left: 14px;
  min-height: 1px;
}

// 左边的样式
.hox-bd-right {
  width: 978px;
  float: left;
  width: 234px;
  margin-left: 14px;
}
.home-brick-box {
  margin-bottom: 8px;
}

.home-brick-box .box-hd .more .tab-list li {
  margin: 0 0 0 30px;
}

.home-brick-box .brick-list,
.home-brick-box .brick-promo-list {
  margin: 0 0 -14px -14px;
}

.home-brick-box .tab-content-hide {
  display: none;
}

.brick-list,
.brick-promo-list {
  height: 614px;
  margin: 0;
  padding: 0;
  list-style-type: none;
}

.brick-list {
  width: 992px;
}

.brick-promo-list a {
  display: block;
  width: 100%;
  height: 100%;
}

.brick-promo-list img {
  width: 234px;
}

.brick-promo-list .brick-item-l img {
  height: 614px;
}

.brick-promo-list .brick-item-m {
  height: 300px;
  padding: 0;
}

.brick-promo-list .brick-item-m img {
  height: 300px;
}

.brick-promo-list .brick-item-s img {
  height: 143px;
}

.brick-item {
  position: relative;
  z-index: 1;
  float: left;
  width: 234px;
  margin-left: 14px;
  margin-bottom: 14px;
  background: #fff;
  transition: all 0.2s linear;
}

.brick-item:hover {
  z-index: 2;
  -webkit-box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
  -webkit-transform: translate3d(0, -2px, 0);
  transform: translate3d(0, -2px, 0);
}

.brick-item-l {
  height: 614px;
}

.brick-item-m {
  height: 246px;
  padding: 34px 0 20px;
}

.brick-item-m .figure-img {
  width: 150px;
  height: 150px;
  margin: 0 auto 18px;
}

.brick-item-m .figure-img a {
  display: block;
  //   text-decoration: none !important;
}

.brick-item-m .figure-img img {
  width: 150px;
  height: 150px;
}

.brick-item-m .title {
  margin: 0 10px;
  font-size: 14px;
  font-weight: 400;
  color: #333;
}

.brick-item-m .desc,
.brick-item-m .title {
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.brick-item-m .desc {
  margin: 0 10px 10px;
  height: 18px;
  font-size: 12px;
  color: #b0b0b0;
}

.brick-item-m .price {
  margin: 0 10px 10px;
  text-align: center;
  color: #ff6700;
}

.brick-item-m .price del {
  margin-left: 0.5em;
  color: #b0b0b0;
}

.brick-item-m-2 {
  height: 260px;
  padding: 20px 0;
}

.brick-item-m-2 .figure-img,
.brick-item-m-2 .figure-img img {
  width: 160px;
  height: 160px;
}

.brick-item-m-2 .title {
  margin: 0 10px 2px;
}

.brick-item-m-2 .price {
  margin: 0 10px 14px;
}

.brick-item-s {
  height: 93px;
  padding-top: 50px;
}

.brick-item-s .figure-img {
  position: absolute;
  right: 20px;
  top: 32px;
  width: 80px;
  height: 80px;
}

.brick-item-s .figure-img a {
  display: block;
}

.brick-item-s .figure-img img {
  width: 80px;
  height: 80px;
}

.brick-item-s .figure-more {
  position: absolute;
  right: 35px;
  top: 48px;
  width: 48px;
  height: 48px;
  color: #ff6700;
}

.brick-item-s .title {
  margin: -10px 110px 5px 30px;
  font-size: 14px;
  font-weight: 400;
}

.brick-item-s .title,
.brick-item-s .title a {
  color: #333;
}

.brick-item-s .title a {
  display: block;
  text-overflow: ellipsis;
}

.brick-item-s .price {
  margin: 0 110px 0 30px;
  font-size: 12px;
  color: #ff6700;
}

.brick-item-s .price .num {
  font-size: 14px;
}

.brick-item-s .more {
  display: block;
  margin: 0 110px 0 30px;
  font-size: 18px;
  color: #333;
}

.brick-item-s .more small {
  display: block;
  font-size: 12px;
  color: #757575;
}

.brick-item-s i {
  font-size: 48px;
  line-height: 48px;
}

// 标题的功能
.xm-plain-box .box-hd {
  position: relative;
  height: 58px;
}

.xm-plain-box .box-hd .title {
  margin: 0;
  font-size: 22px;
  font-weight: 200;
  line-height: 58px;
  color: #333;
}

.xm-plain-box .box-hd .title small {
  margin-left: 10px;
  font-size: 14px;
}

.xm-plain-box .box-hd .title .tip {
  color: #757575;
}

.xm-plain-box .box-hd .more {
  position: absolute;
  top: 0;
  right: 0;
}

.xm-plain-box .box-hd .more .more-link {
  font-size: 16px;
  line-height: 58px;
  color: #424242;
  -webkit-transition: all 0.4s;
  transition: all 0.4s;
}

.xm-plain-box .box-hd .more .more-link:hover {
  color: #ff6700;
}

.xm-plain-box .box-hd .more .more-link:hover .iconfont {
  background: #ff6700;
}

.xm-plain-box .box-hd .more .more-link .iconfont {
  width: 12px;
  height: 12px;
  padding: 4px;
  margin-left: 8px;
  border-radius: 16px;
  font-size: 12px;
  line-height: 12px;
  background: #b0b0b0;
  color: #fff;
  vertical-align: 1px;
  -webkit-transition: all 0.4s;
  transition: all 0.4s;
}

.xm-plain-box .box-hd .more .control {
  margin-left: -1px;
}

.xm-plain-box .box-hd .more .tab-list {
  margin: 0;
  padding: 16px 0 0;
  list-style-type: none;
  font-size: 16px;
}

.xm-plain-box .box-hd .more .tab-list li {
  display: inline-block;
  padding: 0;
  margin: 0 15px;
  color: #424242;
  border-bottom: 2px solid #f5f5f5;
  border-bottom: 2px solid transparent;
  -webkit-transition: border 0.3s;
  transition: border 0.3s;
  cursor: pointer;
}

.xm-plain-box .box-hd .more .tab-list li.tab-active,
.xm-plain-box .box-hd .more .tab-list li:hover {
  color: #ff6700;
  border-bottom: 2px solid #ff6700;
}
</style>
